﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace TheLogWatcher
{
    public class PredefinedConfigs
    {
        private static List<FormatConfigs> configs = new List<FormatConfigs>();
        public static List<FormatConfigs> Configs
        {
            get
            {
                configs.Add(Standard());
                return configs;
            }
        }

        private static FormatConfigs Standard()
        {
            FormatConfigs config = new FormatConfigs();
            // Standard name when creating user config
            config.Name = "Nameless Log Format";
            /////////////////////////////////////////////////////////////////////
            FormatConfigsTypeProperty dayProp1 = new FormatConfigsTypeProperty();
            dayProp1.ID = 1;
            dayProp1.DateFormat = "d";
            dayProp1.RegEx = @"\d{1,2}";
            dayProp1.Description = "9,12";
            //
            FormatConfigsTypeProperty dayProp2 = new FormatConfigsTypeProperty();
            dayProp2.ID = 2;
            dayProp2.DateFormat = "dd";
            dayProp2.RegEx = @"\d{2}";
            dayProp2.Description = "09,12";
            /////////////////////////////////////////////////////////////////////
            FormatConfigsTypeProperty monthProp1 = new FormatConfigsTypeProperty();
            monthProp1.ID = 1;
            monthProp1.DateFormat = "M";
            monthProp1.RegEx = @"\d{1,2}";
            monthProp1.Description = "9,12";
            //
            FormatConfigsTypeProperty monthProp2 = new FormatConfigsTypeProperty();
            monthProp2.ID = 2;
            monthProp2.DateFormat = "MM";
            monthProp2.RegEx = @"\d{2}";
            monthProp2.Description = "09,12";
            //
            FormatConfigsTypeProperty monthProp3 = new FormatConfigsTypeProperty();
            monthProp3.ID = 3;
            monthProp3.DateFormat = "MMM";
            monthProp3.RegEx = @"\w+?";
            monthProp3.Description = "Sep,Dec";
            //
            FormatConfigsTypeProperty monthProp4 = new FormatConfigsTypeProperty();
            monthProp4.ID = 4;
            monthProp4.DateFormat = "MMMM";
            monthProp4.RegEx = @"\w+?";
            monthProp4.Description = "September,December";
            /////////////////////////////////////////////////////////////////////
            FormatConfigsTypeProperty yearProp1 = new FormatConfigsTypeProperty();
            yearProp1.ID = 1;
            yearProp1.DateFormat = "yy";
            yearProp1.RegEx = @"\d{2}";
            yearProp1.Description = "06,07";
            //
            FormatConfigsTypeProperty yearProp2 = new FormatConfigsTypeProperty();
            yearProp2.ID = 2;
            yearProp2.DateFormat = "yyyy";
            yearProp2.RegEx = @"\d{4}";
            yearProp2.Description = "2006,2007";
            /////////////////////////////////////////////////////////////////////
            FormatConfigsTypeProperty hourProp1 = new FormatConfigsTypeProperty();
            hourProp1.ID = 1;
            hourProp1.DateFormat = "H";
            hourProp1.RegEx = @"\d{1,2}";
            hourProp1.Description = "9,12";
            //
            FormatConfigsTypeProperty hourProp2 = new FormatConfigsTypeProperty();
            hourProp2.ID = 2;
            hourProp2.DateFormat = "HH";
            hourProp2.RegEx = @"\d{2}";
            hourProp2.Description = "09,12";
            /////////////////////////////////////////////////////////////////////
            FormatConfigsTypeProperty minuteProp1 = new FormatConfigsTypeProperty();
            minuteProp1.ID = 1;
            minuteProp1.DateFormat = "m";
            minuteProp1.RegEx = @"\d{1,2}";
            minuteProp1.Description = "9,12";
            //
            FormatConfigsTypeProperty minuteProp2 = new FormatConfigsTypeProperty();
            minuteProp2.ID = 2;
            minuteProp2.DateFormat = "mm";
            minuteProp2.RegEx = @"\d{2}";
            minuteProp2.Description = "09,12";
            /////////////////////////////////////////////////////////////////////
            FormatConfigsTypeProperty secondProp1 = new FormatConfigsTypeProperty();
            secondProp1.ID = 1;
            secondProp1.DateFormat = "s";
            secondProp1.RegEx = @"\d{1,2}";
            secondProp1.Description = "9,12";
            //
            FormatConfigsTypeProperty secondProp2 = new FormatConfigsTypeProperty();
            secondProp2.ID = 2;
            secondProp2.DateFormat = "ss";
            secondProp2.RegEx = @"\d{2}";
            secondProp2.Description = "09,12";
            /////////////////////////////////////////////////////////////////////
            FormatConfigsTypeProperty milliSecondProp1 = new FormatConfigsTypeProperty();
            secondProp1.ID = 1;
            secondProp1.DateFormat = "SSS";
            secondProp1.RegEx = @"\d{3}";
            secondProp1.Description = "942,122";
            /////////////////////////////////////////////////////////////////////
            FormatConfigsTypeProperty typeProp1 = new FormatConfigsTypeProperty();
            typeProp1.ID = 1;
            typeProp1.DateFormat = "type";
            typeProp1.RegEx = @"\w+?";
            typeProp1.Description = "WARN,ERROR";
            /////////////////////////////////////////////////////////////////////
            FormatConfigsTypeProperty packageProp1 = new FormatConfigsTypeProperty();
            packageProp1.ID = 1;
            packageProp1.DateFormat = "type";
            packageProp1.RegEx = @".+?";
            packageProp1.Description = "java.net.Socket";
            /////////////////////////////////////////////////////////////////////
            config.addObj("Day", 2, @"", new ArrayList() { dayProp1, dayProp2 });
            config.addObj("Month", 2, @"\.", new ArrayList() { monthProp1, monthProp2, monthProp3, monthProp4 });
            config.addObj("Year", 2, @"\.", new ArrayList() { yearProp1, yearProp2 });
            config.addObj("Hour", 2, @"\s", new ArrayList() { hourProp1, hourProp2 });
            config.addObj("Minute", 2, @":", new ArrayList() { minuteProp1, minuteProp2 });
            config.addObj("Second", 2, @":", new ArrayList() { secondProp1, secondProp2 });
            config.addObj("Millisecond", 1, @".", new ArrayList() { milliSecondProp1 });
            config.addObj("Type", 1, @"\s\[", new ArrayList() { typeProp1 });
            config.addObj("Package", 1, @"\]\W+?", new ArrayList() { packageProp1 });
            config.addObj("Text", 0, @"\W-\W", new ArrayList());
            return config;
        }
    }
}
